<%--
  Created by IntelliJ IDEA.
  User: 张77
  Date: 2023/9/25
  Time: 19:16
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>员工信息</title>
    <link rel="stylesheet" href="../../static/css/element-ui.css">
    <script src="../../static/js/vue.js"></script>
    <script src="../../static/js/axios.min.js"></script>
    <script src="../../static/js/element_index.js"></script>
</head>
<body>
<div id="app">

    <el-form :inline="true" :model="staffForm">
        <el-form-item label="编号">
            <el-input v-model="staffForm.staffid" placeholder="请输入员工编号"></el-input>
        </el-form-item>
        <el-form-item label="姓名">
            <el-input v-model="staffForm.staffname" placeholder="请输入员工姓名"></el-input>
        </el-form-item>
        <el-form-item label="选择分店">
            <el-select v-model="staffForm.branchid" clearable placeholder="请选择">
                <el-option
                        v-for="b in branchs"
                        :key="b.branchid"
                        :label="b.branchname"
                        :value="b.branchid">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="search(1)">搜索</el-button>
        </el-form-item>
    </el-form>
    <el-button type="success" @click="addVisible=true">新增</el-button>
    <el-table
            :data="staffs"
            :cell-style="{'text-align':'center'}"
            :header-cell-style="{'text-align':'center'}"
            style="width: 100%">
        <el-table-column width="100px" show-overflow-tooltip prop="staffid" label="员工编号"></el-table-column>
        <el-table-column width="100px" show-overflow-tooltip prop="staffname" label="员工姓名"></el-table-column>
        <el-table-column width="120px" show-overflow-tooltip prop="idcard" label="身份证号码"></el-table-column>
        <el-table-column prop="address" show-overflow-tooltip label="地址" width="90px"></el-table-column>
        <el-table-column prop="phone" show-overflow-tooltip label="电话号码" width="130px"></el-table-column>
        <el-table-column width="120px" show-overflow-tooltip prop="entrytime" label="入职日期"></el-table-column>
        <el-table-column width="150px" show-overflow-tooltip prop="branch.branchname" label="店名"></el-table-column>
        <el-table-column width="130px" show-overflow-tooltip prop="role.rolename" label="职位名称"></el-table-column>
        <el-table-column width="100px" show-overflow-tooltip prop="department.deptname"
                         label="部门名称"></el-table-column>
        <el-table-column width="100px" show-overflow-tooltip prop="role.remark" label="职务描述"></el-table-column>
        <el-table-column width="100px" prop="state" label="状态" fixed="right">
            <template slot-scope="scope">
                <el-tag
                        type="success"
                        v-if="scope.row.state==1"
                        effect="dark">
                    工作状态
                </el-tag>
                <el-tag
                        type="info"
                        v-if="scope.row.state==2"
                        effect="dark">
                    冻结状态
                </el-tag>
            </template>
        </el-table-column>
        <el-table-column fixed="right" label="操作" width="380px">
            <template slot-scope="scope">
                <div v-if="scope.row.staffid == '111'"
                     style="text-align: center;color: black;font-weight: 900;font-size: 22px">
                    大老板
                </div>
                <el-row v-else>
                    <el-button type="success" size="mini" @click="editStaff(scope.row)">编辑</el-button>
                    <el-button type="primary" size="mini" @click="mobilize(scope.row)">调动</el-button>
                    <el-button type="danger" size="mini" @click="departure(scope.row)">离职</el-button>
                    <el-button disabled size="mini">删除</el-button>
                    <el-button :type="scope.row.state=='1'?'primary':'danger'" size="mini" @click="freeze(scope.row)">
                        {{scope.row.state=='1'?'冻结':'解冻'}}
                    </el-button>
                </el-row>
            </template>
        </el-table-column>

    </el-table>
    <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="current"
            :page-sizes="[5, 10, 15, 20]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total">
    </el-pagination>
    <%--    编辑的对话框--%>
    <el-dialog title="修改员工" :visible.sync="dialogVisible" width="50%">
        <%--        编辑表单--%>
        <el-form ref="editStaffFrom" :rules="updateRole" :model="editStaffFrom" label-width="80px">
            <el-form-item label="工号">
                <el-input v-model="editStaffFrom.staffid" :readonly="true"></el-input>
            </el-form-item>
            <el-form-item label="员工名称">
                <el-input v-model="editStaffFrom.staffname" :readonly="true"></el-input>
            </el-form-item>
            <el-form-item label="身份证号">
                <el-input v-model="editStaffFrom.idcard" :readonly="true"></el-input>
            </el-form-item>
            <el-form-item label="员工住址" prop="address">
                <el-input v-model="editStaffFrom.address" placeholder="请输入员工地址"></el-input>
            </el-form-item>
            <el-form-item label="联系方式" prop="phone">
                <el-input @blur="editcheckPhoneNumber(editStaffFrom)" v-model="editStaffFrom.phone"></el-input>
            </el-form-item>
            <el-form-item label="入职日期">
                <el-input v-model="editStaffFrom.entrytime" :readonly="true"></el-input>
            </el-form-item>
            <el-form-item label="门店店名">
                <el-input v-model="editStaffFrom.branch.branchname" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="部门名称">
                <el-select v-model="editStaffFrom.department.deptid" placeholder="请选择" disabled>
                    <el-option v-for="item in deptmentData" :key="item.deptid" :label="item.deptname"
                               :value="item.deptid">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="权限">
                <el-input v-model="editStaffFrom.role.rolename" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item size="large">
                <el-button type="primary" @click="updateStaffConfirm('editStaffFrom')">提交</el-button>
                <el-button @click="dialogVisible = false">取消</el-button>
            </el-form-item>
        </el-form>
    </el-dialog>


    <%--新增的弹出层--%>
    <el-dialog title="新增员工" :visible.sync="addVisible" width="50%">
        <%--        新增表单--%>
        <el-form :rules="addRole" ref="addStaffFrom" :model="addStaffFrom" label-width="80px">
            <el-form-item label="工号" prop="staffid">
                <el-input @blur="staffId(addStaffFrom.staffid)" v-model="addStaffFrom.staffid"
                          placeholder="请选择员工工号"></el-input>
            </el-form-item>
            <el-form-item label="员工名称" prop="staffname">
                <el-input v-model="addStaffFrom.staffname" placeholder="请选择员工姓名"></el-input>
            </el-form-item>
            <el-form-item label="密码" prop="password">
                <el-input v-model="addStaffFrom.password" placeholder="请选择员工密码"></el-input>
            </el-form-item>
            <el-form-item label="身份证号" prop="idcard">
                <el-input @blur="checkIdCar(addStaffFrom.idcard)" v-model="addStaffFrom.idcard"
                          placeholder="请选择员工身份证号码"></el-input>
            </el-form-item>
            <el-form-item label="员工住址" prop="address">
                <el-input v-model="addStaffFrom.address" placeholder="请选择员工住址"></el-input>
            </el-form-item>
            <el-form-item label="联系方式" prop="phone">
                <el-input @blur="checkPhoneNumber(addStaffFrom.phone)" v-model="addStaffFrom.phone"
                          placeholder="联系方式"></el-input>
            </el-form-item>
            <el-form-item label="入职日期" prop="entrytime">
                <el-date-picker
                        value-format="yyyy-MM-dd HH:mm:ss"
                        v-model="addStaffFrom.entrytime"
                        type="datetime"
                        placeholder="yyyy-MM-dd HH:mm:ss">
                </el-date-picker>
            </el-form-item>
            <el-form-item label="类别" prop="state">
                <el-select v-model="addStaffFrom.state" placeholder="--类别--">
                    <el-option label="在职" value=1></el-option>
                    <el-option label="离职" value=2></el-option>
                </el-select>
            </el-form-item>
            </el-date-picker>
            <el-form-item label="门店店名" prop="branch.branchid">
                <el-select v-model="addStaffFrom.branch.branchid" placeholder="--门店--">
                    <el-option v-for="item in branchs" :key="item.branchid" :label="item.branchname"
                               :value="item.branchid">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="部门名称" prop="deptid">
                <el-select v-model="addStaffFrom.deptid" placeholder="--部门--">
                    <el-option v-for="item in deptmentData" :key="item.deptid" :label="item.deptname"
                               :value="item.deptid">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="权限" prop="roleid">
                <el-select v-model="addStaffFrom.roleid" placeholder="--权限--">
                    <el-option v-for="item in role" :key="item.roleid" :label="item.rolename"
                               :value="item.roleid">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item size="large">
                <el-button type="primary" @click="addStaff('addStaffFrom')">添加</el-button>
                <el-button @click="addVisible = false">取消</el-button>
            </el-form-item>
        </el-form>
    </el-dialog>


    <%--调动弹出层--%>
    <el-dialog title="调动员工" :visible.sync="mobilizeVisible" width="50%">
        <el-form label-width="80px" :model="mobilizeForm" v-if="mobilizeForm">
            <el-form-item label="工号">
                <el-input v-model="mobilizeForm.staffid" :readonly="true"></el-input>
            </el-form-item>
            <el-form-item label="员工名称">
                <el-input v-model="mobilizeForm.staffname" :readonly="true"></el-input>
            </el-form-item>
            <el-form-item label="旧店店名">
                <el-input v-model="mobilizeForm.branch.branchname" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="旧部门名">
                <el-select v-model="mobilizeForm.department.deptid" placeholder="请选择" disabled>
                    <el-option v-for="item in deptmentData" :key="item.deptid" :label="item.deptname"
                               :value="item.deptid">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="新店店名">
                <el-select v-model="mobilizeForm.newbranchid" placeholder="请选择">
                    <el-option v-for="item in branchs" :key="item.deptid" :label="item.branchname"
                               :value="item.branchid">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="新部门名">
                <el-select v-model="mobilizeForm.newdeptid" placeholder="请选择">
                    <el-option v-for="item in deptmentData" :key="item.deptid" :label="item.deptname"
                               :value="item.deptid">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="mobilizeSubmitForm">立即提交</el-button>
                <%--                <el-button @click="mobilizeForm('ruleForm')">重置</el-button>--%>
            </el-form-item>
        </el-form>
    </el-dialog>
</div>

<style>
    .el-table .warning-row {
        background: oldlace;
    }

    .el-table .success-row {
        background: #f0f9eb;
    }
</style>

<script>
    let app = new Vue({
        el: "#app",
        data: {
            //编辑修改表单对象
            editStaffFrom: {
                branch: {
                    branchname: ''
                },
                role: {
                    rolename: ''
                },
                department: {
                    deptid: ''
                }
            },
            //编辑新增表单对象
            addStaffFrom: {
                branch: {
                    branchname: ''
                },
                role: {
                    rolename: ''
                },
                department: {
                    deptid: ''
                }
            },
            //编辑对话框的显示和隐藏
            dialogVisible: false,
            //所有员工的信息
            staffs: [],
            //总条数
            total: 0,
            //每页显示的大小
            pageSize: 5,
            //当前页码
            current: 1,
            //表单搜索对象
            staffForm: {
                staffname: ''
            },
            //branchs所有门店的列表
            branchs: [],
            //部门名称列表
            deptmentData: [],
            //工作状态
            stateDate: [],
            //获取所有的职位名字
            role: [],
            //新增员工信息弹出框
            addVisible: false,
            //修改校验
            updateRole: {
                address: [
                    {required: true, message: '员工地址不能为空', trigger: 'blur'}
                ],
                phone: [
                    {required: true, message: '手机号必填', trigger: 'blur'},
                    {pattern: /^1[3456789]\d{9}$/, message: '手机号码格式不正确', trigger: 'blur'}
                ]
            },
            addRole: {
                staffid: [
                    {required: true, message: '请输入工号', trigger: 'blur'}
                ],
                staffname: [
                    {required: true, message: '请输入名称', trigger: 'blur'}
                ],
                password: [
                    {required: true, message: '请输入密码', trigger: 'blur'}
                ],
                idcard: [
                    {required: true, message: '身份证号不能为空'},
                    {type: 'string', message: '身份号必须为数字'},
                    {
                        pattern: /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
                        message: '不是合法的身份证号！', trigger: 'blur'
                    }
                ],
                address: [
                    {required: true, message: '员工地址不能为空', trigger: 'blur'}
                ],
                phone: [
                    {required: true, message: '手机号必填', trigger: 'blur'},
                    {pattern: /^1[3456789]\d{9}$/, message: '手机号码格式不正确', trigger: 'blur'}
                ],
                entrytime: [
                    {required: true, message: '时间不能为空', trigger: 'change'}
                ],
                state: [
                    {required: true, message: '请选择类别', trigger: 'change'}
                ],
                'branch.branchid': [
                    {required: true, message: '请选择门店', trigger: 'change'}
                ],
                deptid: [
                    {required: true, message: '请选择部门名称', trigger: 'change'}
                ],
                roleid: [
                    {required: true, message: '请选择权限', trigger: 'change'}
                ],
            },
            //身份证校验
            idcare: [
                {required: true, message: '身份证号不能为空'},
                {type: 'string', message: '身份号必须为数字'},
                {
                    pattern: /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
                    message: '不是合法的身份证号！', trigger: 'blur'
                }
            ],
            //手机号校验
            phoecare: [
                {required: true, message: '手机号不能为空'},
                {type: 'string', message: '手机号必须为数字'},
                {
                    pattern: /^1[3456789]\d{9}$/,
                    message: '不是合法的手机号！', trigger: 'blur'
                }
            ],

            /*调动信息*/
            //调动弹出层
            mobilizeVisible: false,
            mobilizeForm: {
                branch: {
                    branchname: ''
                },
                role: {
                    rolename: ''
                },
                department: {
                    deptid: ''
                }
            },

            isAdd: false,
            isAddPhone: false,
            isAddIdCar: false,


            isUpdate: false,
            userInfo: {}
        },
        created() {
            this.initTable();
            this.initBranchInfo();
            this.initDeptmentInfo();
            this.initstateDateinfo();
            this.initrole();
            this.initUserInfo();
        },

        methods: {

            initrole() {
                axios.get("/staff/info2").then(function (resp) {
                    app.role = resp.data.data;
                })
            },

            initTable() {
                axios.post("/staff/staffInfo?current=" + this.current + "&pageSize=" + this.pageSize, this.staffForm).then(function (resp) {
                    app.staffs = resp.data.data.rows;
                    app.total = resp.data.data.total;
                })
            },
            initBranchInfo() {
                axios.get("/branch/info").then(function (resp) {
                    app.branchs = resp.data.data;
                })
            },
            /*获取所有部门名称信息*/
            initDeptmentInfo() {
                axios.get('/staff/getDeptmentNew').then(res => {
                    this.deptmentData = res.data.data;
                })
            },
            initUserInfo() {
                axios.get('/staff/info1').then(res => {
                    this.userInfo = res.data.data;
                })
            },
            // 获取在职状态信息
            initstateDateinfo() {
                axios.get('/staff/getState').then(res => {
                    this.stateDate = res.data.data;
                })
            },
            handleSizeChange(val) {
                this.pageSize = val;
                this.initTable()
            },
            handleCurrentChange(val) {
                this.current = val;
                this.initTable();
            },
            //搜索
            search(status) {
                if (status === 1) {
                    this.current = 1;
                }
                this.initTable();
            },
            //编辑员工
            editStaff(row) {
                this.dialogVisible = true;
                this.editStaffFrom = row;
            },
            offStaff() {
                this.dialogVisible = false;
            },
            onSubmit() {
                axios.post('/staff/updateStaff', this.editStaffFrom).then(res => {
                    if (res.data.code === 200) {
                        this.$notify({
                            title: '成功',
                            message: '修改员工信息成功！',
                            type: 'success'
                        });
                    } else {
                        this.$notify.error({
                            title: '错误',
                            message: '修改失败，请联系管理员解决'
                        });
                    }
                    this.dialogVisible = false;
                    this.initTable();
                })
            },
            /*添加员工到数据库*/
            addStaff(addStaffFrom) {
                this.$refs.addStaffFrom.validate((valid) => {
                    if (valid) {
                        if (this.isAdd) {
                            if (this.isAddIdCar) {
                                if (this.isAddPhone) {
                                    axios.post('/staff/addStaff', this.addStaffFrom).then(res => {
                                        if (res.data.code === 200) {
                                            this.initTable();
                                            this.$message.success('添加成功！');
                                            this.addVisible = false;
                                        } else {
                                            this.$message.error('添加失败！');
                                        }
                                        this.addStaffFrom = {
                                            branch: {
                                                branchname: ''
                                            },
                                            role: {
                                                rolename: ''
                                            },
                                            department: {
                                                deptid: ''
                                            }
                                        }
                                        this.isAdd = false;
                                        this.isAddIdCar = false;
                                        this.isAddPhone = false;
                                    })
                                } else {
                                    this.checkPhoneNumber(this.addStaffFrom.phone);
                                }
                            } else {
                                this.checkIdCar(this.addStaffFrom.idcard);
                            }
                        } else {
                            this.staffId(this.addStaffFrom.staffid);
                        }
                    } else {
                        return false;
                    }
                });
                // console.log(this.addStaffFrom)
            },
            //身份证号码校验函数
            isvalidcard(idcard) {
                if (!idcard || idcard.length !== 18) {
                    return false;
                }
                //校验身份证号码的前17位是否为数字
                const idcard17 = idcard.substring(0, 17);
                if (!/^\d+$/.test(idCard17)) {
                    return false;
                }
                //校验身份证号码的校验位
                const idcard18code = idcard.substring(17);
                const idcardArray = idcard17.split("");
                const factor = [
                    7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2
                ];
                const checkcode = [
                    "1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"
                ];
                let sum = 0;
                for (let i = 0; i < 17; i++) {
                    sum += parseInt(idcardArray[i]) * factor[i];
                }
                const mod = sum % 11;
                if (idcard18code.toUpperCase() !== checkcode[mod]) {
                    return false;
                }
                return true
            },
            /*冻结*/
            freeze(row) {
                if (row.roleid == 1 && this.userInfo.staffid != 111) {
                    this.$message({
                        type: 'error',
                        message: '店长不能冻结！！!'
                    });
                    return;
                }
                if (row.state === 1) {
                    this.$confirm('确定冻结该员工吗?', '信息', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(() => {
                        axios.post('/staff/updateStaff', {
                            "staffid": row.staffid,
                            "state": 2
                        }).then(res => {
                            if (res.data.code === 200) {
                                this.$message({
                                    type: 'success',
                                    message: '冻结成功!'
                                });
                                this.initTable();
                            } else {
                                this.$message.error('冻结失败！');
                            }
                        })

                    }).catch(() => {
                        this.$message({
                            type: 'info',
                            message: '已取消冻结'
                        });
                    });
                    this.initTable();

                } else {
                    this.$confirm('确定解冻该员工吗?', '信息', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(() => {
                        axios.post('/staff/updateStaff', {
                            "staffid": row.staffid,
                            "state": 1
                        }).then(res => {
                            if (res.data.code === 200) {
                                this.$message({
                                    type: 'success',
                                    message: '解冻成功!'
                                });
                                this.initTable();
                            } else {
                                this.$message.error('解冻失败！');
                            }
                        })

                    }).catch(() => {
                        this.$message({
                            type: 'info',
                            message: '已取消解冻'
                        });
                    });
                    this.initTable();

                }


            },
            /*进行离职*/
            departure(row) {
                if (row.roleid == 1) {
                    this.$message({
                        type: 'error',
                        message: '此员工为店长，不能直接离职，请到店铺管理中更改！！!'
                    });
                    return;
                }
                this.$confirm('确定离职该员工吗?', '信息', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    axios.post('/staff/updateStaff', {
                        "staffid": row.staffid,
                        "state": 0
                    }).then(res => {
                        if (res.data.code === 200) {
                            this.$message({
                                type: 'success',
                                message: '操作成功!'
                            });
                            this.initTable();
                        } else {
                            this.$message.error('离职失败！');
                        }
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消离职'
                    });
                });
            },

            /*调动按钮*/
            mobilize(row) {
                //进行判断是否打开弹出层
                axios.get('/staff/transferJudgment?staffid=' + row.staffid).then(res => {
                    if (res.data.code === 202 || res.data.code === 203) {
                        this.$message.warning(res.data.msg);
                    } else if (res.data.code === 200) {
                        this.mobilizeForm = row;
                        this.mobilizeVisible = true;
                    } else {
                        this.$message.error('调动失败，请联系管理员解决！');
                    }
                })
            },
            /*调动提交*/
            mobilizeSubmitForm() {
                axios.post('/staff/transferConfirmed', this.mobilizeForm).then(res => {
                    if (res.data.code === 200) {
                        this.$message('操作成功');
                    } else {
                        this.$message.error('提交失败，请联系管理员解决！');
                    }
                    this.mobilizeVisible = false;
                })
            },


            /*修改员工确定按钮*/
            updateStaffConfirm(formName) {
                this.$refs.editStaffFrom.validate((valid) => {
                    if (valid) {
                        if (this.isUpdate) {
                            axios.post('/staff/updateStaff', this.editStaffFrom).then(res => {
                                if (res.data.code === 200) {
                                    this.$notify({
                                        title: '成功',
                                        message: '修改员工信息成功！',
                                        type: 'success'
                                    });
                                } else {
                                    this.$notify.error({
                                        title: '错误',
                                        message: '修改失败，请联系管理员解决'
                                    });
                                }
                                this.isUpdate = false;
                                this.dialogVisible = false;
                                this.initTable();
                            })
                        } else {
                            this.editcheckPhoneNumber(this.editStaffFrom)
                        }
                    } else {
                        return false;
                    }
                });

            },

            /*判断手机号是否存在*/
            checkPhoneNumber(phone) {
                axios.get('/staff/phoneIsReplace?phone=' + phone).then(res => {
                    if (res.data.code === 202) {
                        this.$message.warning(res.data.msg);
                        this.isAddPhone = false;
                    } else {
                        this.isAddPhone = true;
                    }
                })
            }
            ,
            /*验证名称是否重复*/
            staffId(staffid) {
                axios.get('/staff/staffidIsReplace?staffid=' + staffid).then(res => {
                    if (res.data.code === 202) {
                        this.$message.warning(res.data.msg);
                        this.isAdd = false;
                    } else {
                        this.isAdd = true;
                    }
                })
            }
            ,

            /*判断身份证是否存在*/
            checkIdCar(car) {
                axios.get('/staff/checkIdCar?idCar=' + car).then(res => {
                    if (res.data.code === 202) {
                        this.$message.warning(res.data.msg);
                        this.isAddIdCar = false;
                    } else {
                        this.isAddIdCar = true;
                    }
                })
            }
            ,

            /*编辑判断身份证是否存在*/
            editcheckPhoneNumber(form) {
                axios.get('/staff/phoneIsReplace?phone=' + form.phone + '&staffid=' + form.staffid).then(res => {
                    if (res.data.code === 202) {
                        this.$message.warning(res.data.msg);
                        this.isUpdate = false;
                    } else {
                        this.isUpdate = true;
                    }
                })
            }
        }

    })
</script>
</body>
</html>
